const db = require('../common/db')

// 定义类型1
class Exam{
    // 增
    add(c_id){
        return new Promise((resolve,reject) => {
            let sql = `insert into course(c_id) values('${c_id}')`
            db.query(sql)
            .then(
                content => {
                    resolve({
                        code:200,
                        msg:'插入成功',
                        content
                    })
                }
            )
            .catch(
                error => {
                    reject({
                        code: -1,
                        msg: '新增失败',
                        error
                    })
                }
            )
        })
    }
    // 删
    deleted(){}
    // 改
    modify(){}
    // 查
    select(){}
}
module.exports = new Exam()